<%@page import="domain.User"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Home</title>
<link rel="stylesheet" type="text/css" href="css/default.css"></link>
<!-- dd menu -->
<script type="text/javascript">
<!--
var timeout         = 500;
var closetimer		= 0;
var ddmenuitem      = 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 
// -->
</script>

</head>
<body>
<% 
//Get the logged in session user
boolean loggedInFlag = false;
User user = (User)session.getAttribute("LOGIN_USER");
String pageName = (String)request.getParameter("page");
if(pageName!=null && pageName.equals("logout")){
	session.removeAttribute("LOGIN_USER");
	user = null;
}
if(user!=null){
	loggedInFlag = true;
}
%>
<% if(loggedInFlag) {%>
<table align="left">
<tr><td colspan="2">
<ul id="sddm">
	<li><a href="menu.jsp">Home</a>
	</li>
    <li><a href="#" onmouseover="mopen('m1')" onmouseout="mclosetime()">Master</a>
		<div id="m1" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">
	        <a href="menu.jsp?page=employee">Employee Details</a>
        </div>
    </li>
    <li><a href="#" onmouseover="mopen('m2')" onmouseout="mclosetime()">Attendance</a>
        <div id="m2" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">        
        	<a href="menu.jsp?page=att_date">By Date Details</a>
	        <a href="menu.jsp?page=att_month">By Month Details</a>
        </div>
    </li>	
    <li><a href="#" onmouseover="mopen('m3')" onmouseout="mclosetime()">Reports</a>
		<div id="m3" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">
			<a href="#">By Date Details</a>
 			<a href="#">By Month Details</a>             
       </div>
    </li>
    <li><a href="menu.jsp?page=logout">Exit</a></li>
</ul>
</td></tr>
</table>
<br/><br/><br/>
<table align="left"><tr><td>
	<% if(pageName!=null && !pageName.equals("")){
		pageName += ".jsp";
	%>		
		<p align="left"><jsp:include page="<%=pageName%>" /></p>
	<% }else{ %>		
		<p align="left"> Welcome home!!</p>
	<% } %>
<% }else{ %>
<jsp:forward page="login.jsp"></jsp:forward>
<%} %></td></tr>
</table>
</body>
</html>